/*
 * @(#)TopFactFilter.java	1.0 2000/12/14
 *
 * Copyright 2000 Thomas Barnekow. All Rights Reserved.
 *
 * This software is the proprietary information of Thomas Barnekow.
 * Use is subject to license terms.
 */

package jessx.util;

import java.util.*;
import jess.Token;

/**
 * <i>TopFactFilter</i> translates <i>Enumeration</i> (of <i>Token</i> objects)
 * resulting from a call to Rete.runQuery to an <i>Iterator</i> of top
 * <i>Fact</i> objects.
 *
 * @author Thomas Barnekow
 * @version 1.0
 */
public class TopFactFilter implements Iterator {

	private Iterator m_tokens;

	public TopFactFilter(Iterator tokens) {
		m_tokens = tokens;
	}

	public boolean hasNext() {
		return m_tokens.hasNext();
	}

	public Object next() {
		return ((Token) m_tokens.next()).topFact();
	}

	/**
	 * This operation is not supported.
	 */
	public void remove() throws UnsupportedOperationException {
		throw new UnsupportedOperationException();
	}
}
